<SCRIPT LANGUAGE="JavaScript">  
    
    function open_win(id)
    {
        window.open('jobs/view/'+id,"_blank","toolbar=no, location=yes, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, top=100, left=100, width=930, height=600");
    }    
    
    function swap(temp)
    {
        if(temp.value=='[ Show Detail ]')
        {
            temp.value='[ Hide ]';
            $("#employer_index_detail").slideDown('fast');
        }
        else
        {
            temp.value='[ Show Detail ]'; 
            $("#employer_index_detail").slideUp('fast');
        }
    }
        
</SCRIPT>

<?php
e($javascript->link('jquery.js'));
echo "<div class='form'>";
    echo $this->element('myfunction'); 
    echo "<h2> My Index Page </h2>";
    echo "<hr color='#2A7EF7'>";  
   
    echo "<table cellpadding=0 cellspacing=0 >";
    echo "<tr><td>";
   
    echo "<div id='employer_index_job'>";
        echo "<div id='employer_index_title'> My Jobs </div>";
        echo " &nbsp :. You have <b>".count(@$posted_job)."</b> posted job(s) &nbsp &nbsp <input type='button' style='background-color:white;border:solid #fff' value='[ Show Detail ]' class='sky' onClick='swap(this);'>";
        
        $style  = "background-color:white;";
        $style .= "position:absolute;";
        $style .= "left:300px;";
        $style .="display:none;";
        
        echo "<div id='employer_index_detail'>";
            $i=1;
            if(count($posted_job))
            {
                echo "<table>";
                foreach(@$posted_job as $job)
                {
                    echo "<tr>";
                    
                    /*
                    echo "<label style='width:200px;float:left'>".$i.". <a href='javascript:open_win(".$job['jobs']['id'].")' class='sky'>".$job['jobs']['position']."</a></label>";
                        $applicant = $this->requestAction('applicants/new_applicant/'.$job['jobs']['id']);
                        echo $html->link($applicant['total']." applicant(s)",array('controller'=>'applicants','action'=>'accept','id'=>$job['jobs']['id'])); 
                        if($applicant['new'])
                        { echo " <font color='red'><sup><b>NEW</b></sup></font>"; }
                    echo "<br>";
                    */
                    
                    echo "<td width=20px valign='top'>".$i.". </td>";
                    echo "<td width=200px><a href='javascript:open_win(".$job['jobs']['id'].")' class='sky'>".$job['jobs']['position']."</a></td>";
                    $applicant = $this->requestAction('applicants/new_applicant/'.$job['jobs']['id']);
                    echo "<td width=120px valign='top'>".$html->link($applicant['total']." applicant(s)",array('controller'=>'applicants','action'=>'accept','id'=>$job['jobs']['id']));
                    if($applicant['new'])
                    { echo " <font color='red'><sup><b>NEW</b></sup></font>"; }                    
                    echo "</td>";
                    
                    
                    $i++;
                    
                    echo "<tr>";
                }
                echo "</table>";
            }
            else
            { echo "<span class='red'>You haven't have any job posted yet!</span>"; }
        echo "</div>";
        echo "<br> &nbsp :. You have <b>".count(@$waited_job)."</b> waited job(s)";
        echo "<br> &nbsp :. You have <b>".count(@$expired_job)."</b> expired job(s)";
        echo "<div id='employer_index_panel'>Post a new Job ".$html->link('[ Here ]',array('controller'=>'jobs','action'=>'post'))."</div>";
    echo "</div>"; 
    
    echo "</td><td>";
    
    echo "<div id='employer_index_job'>"; 
        echo "<div id='employer_index_title'> My Advs </div>";
        echo " &nbsp :. You have <b>".count(@$posted_adv)."</b> posted adv(s)";
        echo "<br> &nbsp :. You have <b>".count(@$waited_adv)."</b> waited adv(s)";
        echo "<br> &nbsp :. You have <b>".count(@$expired_adv)."</b> expired adv(s)";
        echo "<div id='employer_index_panel'>Post a new Adv ".$html->link('[ Here ]',array('controller'=>'advs','action'=>'post'))."</div>";
    echo "</div>";
    
    echo"</td></tr>";
    echo "</table>";
    
echo "</div>"; 
?>